/*
 * @Description: 工具栏配置
 * @Author: HuiSir<https://gitee.com/huisir001>
 * @Date: 2025-07-28 21:55:31
 * @LastEditTime: 2025-09-15 18:06:42
 */
import { defineToolsOptions } from "@/components/TablePage/predefined";
import useEditOptions from "./useEditOptions";
import { addPerm } from "@/api/sys";
import { project } from "@/init/config";

export default defineToolsOptions(() => ({
  tools: ["add", "fold", "export", "refresh", "cols"],
  addRequest: addPerm,
  addDialogProps: { title: "新增权限" },
  addFormOptions: useEditOptions(),
  addFormDefaultData: {
    pid: project.defaultTreeData.ancestorId,
    orderRank: 0,
    keepAlive: true,
    internal: true,
    blank: false,
  } as Permission,
  beforeAddSubmit(formData) {
    formData.value.name = formData.value.title;
  },
}));
